import java.util.HashMap;
import java.util.Map;

public class EmailAccount {
	// Paolo is so crazy for saying that looking up Map/HashMap is more trouble
	// than making your own version. Isn't the whole point of OOP to avoid re-inventing
	// the wheel?
    private static Map<String, Integer> m = new HashMap<String,Integer>();
    private String firstName, secondName;
    private Integer num;
   
    public EmailAccount(String first, String second) {
        this.firstName = new String(first);
        this.secondName = new String(second);
        second = second.toLowerCase();
        // Determine the appropriate .# and store it in the instance and in the static map
        if (m.containsKey(second)) {
			Integer i = m.remove(second);
			i++;
			this.num = i;
			m.put(second, i);
		} else {
			this.num = 1;
			m.put(second, 1);
		}
    }
    public String getEmailAddress() {
        return this.secondName.toLowerCase() + "." + this.num + "@osu.edu";
    }
    public String getName() {
        return this.firstName + " " + this.secondName;
    }
}
